<?php
/**
 * Created by PhpStorm.
 * User: HLG
 * Date: 2019/10/14
 * Time: 16:46
 */
namespace app\api\controller;
use app\api\model\Balance;//钱包model
use think\Controller;
use think\Request;

class User extends BaseController
{
    protected $user;
    protected $address;
    public function __construct()
    {
        parent::__construct();
        $this->user = new \app\api\model\User();
        $this->balanceLog = new \app\api\model\BalanceLog();
        $this->balance = new Balance();
        $this->user->editTime();//更新每日挖矿次数
    }
    /**
     * 修改密码
     */
    public function editPassword()
    {
        $data = input('post.');
        $result = $this->user->editPassword($this->uid,$data);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 获取用户信息
     */
    public function getUser()
    {
        $data = input('post.');
        $result = $this->user->getUser($this->uid);
        AjaxReturn(1,'成功',$result);
    }
    /**
     * 修改用户信息
     */
    public function editUser()
    {
        $data = input('post.');
        $result = $this->user->editUser($this->uid,$data);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 我的钱包
     */
    public function  getBalance(){
        $uid=$this->uid;
        $result['info']=$this->balance->getBalance($uid);//获取矿石余额
        $result['list']=$this->balanceLog->getBalacnLog($uid);//获取矿石记录
        AjaxReturn(1,'成功',$result);
    }
    /**
     * 实名认证
     */
    public function authentication()
    {
        $result = $this->user->authentication($this->uid);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 获取实名认证
     */
    public function authenticationInfo()
    {
        $result = $this->user->authenticationInfo($this->uid);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 上传接口
     */
    public function upload()
    {
        $result = $this->user->upload($this->uid);
        AjaxReturn(1,'成功',$result);
    }
    /**
     * 添加收款方式
     */
    public function addPayMent()
    {
        $data=input('post.');
        $result = $this->user->addPayMent($this->uid,$data);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 获取收款方式
     */
    public function getPayMent()
    {
        $patment=input('post.payment');
        $result = $this->user->getPayMent($this->uid,$patment);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 获取平台收款方式
     */
    public function getPayList()
    {
        $result = $this->user->getPayList();
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 充值
     */
    public function addPay()
    {
        $data=input('post.');
        $result = $this->user->addPay($this->uid,$data);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 提现
     */
    public function cash()
    {
        $data=input('post.');
        $result = $this->user->cash($this->uid,$data);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 获取收益列表
     */
    public function getPrice()
    {
        $result = $this->user->getPrice($this->uid);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 获取系统消息
     */
    public function getMessage()
    {
        $result = $this->user->getMessage($this->uid);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 获取系统详情
     */
    public function messageInfo()
    {
        $mid=input('post.mid');
        $result = $this->user->messageInfo($mid);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 获取系统详情
     */
    public function getConfig()
    {
        $result = $this->user->getConfig();
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 修改信息状态
     */
    public function messageSave()
    {
        $mid=input('post.mid');
        $result = $this->user->messageSave($this->uid,$mid);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 点击采矿
     */
    public function  clickMining(){
        $mine_id=input('post.mine_id');
        $result = $this->user->clickMining($this->uid,$mine_id);
        AjaxReturn($result['code'],$result['msg'],$result['data']);
    }
    /**
     * 采矿结束
     */
    public function  endMining(){
        $mine_id=input('post.mine_id');
        $result = $this->user->endMining($this->uid,$mine_id);
        AjaxReturn($result['code'],$result['msg']);
    }
    /**
     * 生成二维码
     */
    public function  QRcode(){
        $result = $this->user->QRcode($this->uid);
        AjaxReturn(1,'成功',$result);
    }
    /**
     * 获取我的团队
     */
    public function  getMyDeal(){
        $result = $this->user->getMyDeal($this->uid);
        AjaxReturn(1,'成功',$result);
    }
    /**
     * 获取收益详情
     */
    public function  getPriceInfo(){
        $id=input('post.id');
        $result = $this->user->getPriceInfo($id);
        AjaxReturn(1,'成功',$result);
    }
    /**
     * 删除银行卡
     */
    public function  deleteBank(){
        $id=input('post.id');
        $result = $this->user->deleteBank($id);
        AjaxReturn(1,'成功',$result);
    }


}